<!--  -->
<template>
  <div class="staffitem">
    <img :src="imgURL+props.staff.staffPhoto" alt="">
    <span>{{props.staff.staffName}}</span>
    <div @click="del(props.staff.id)" class="close">
        X
    </div>
  </div>
</template>

<script lang='ts' setup>
import { reactive,toRefs,ref,defineProps,defineEmits} from 'vue'

import { deleteSchedule } from '../../apis/elderly/elderly';

const emits=defineEmits(['reload'])

const imgURL =ref(import.meta.env.VITE_IMG_BASE_URL);

const del=async (id:number)=>{

    await deleteSchedule(id);
    emits("reload")


}

const props = defineProps({
    staff:{
        type:Object,
        required:true
    }
})

</script>
<style scoped lang="less">
.staffitem{

    display: flex;
    position: relative;
    margin-top: 20px;
    img{
        width: 30px;
        height: 30px;
        margin-right: 10px;
        border-radius: 50%;
    }
    .close{
        position: absolute;
        top: -10px;
        left:25px;
        width: 20px;
        height: 20px;
        background: #ececec;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
    }

      
}

</style>